import { observable } from "mobx";
import { recommendSong } from "../../services";

export default observable({
  //推荐歌单
  recSongList: [],
  recSongLimit: 0,
  //获取推荐歌单列表
  getRecSongList(refresh){
    return new Promise((resolve, reject) => {
      if(refresh){
        this.recSongLimit = 30;
      }else{
        this.recSongLimit += 30;
      }
      recommendSong({limit: this.recSongLimit}).then(({result}) => {
        this.recSongList = refresh ? result : this.recSongList.concat(result);
      }).finally(resolve)
    })
  }

});

